package com.woniu.apiImpl;

import com.woniu.api.HisDiseaseQueryApi;
import com.woniu.dto.AllHisDiseaseDto;
import com.woniu.dto.HisDiseaseDto;
import com.woniu.dto.PageDTO;
import com.woniu.param.AddHisDiseaseParam;
import com.woniu.param.ListHisDiseaseParam;
import com.woniu.param.ModifyDiseaseParam;
import com.woniu.service.HisDiseaseService;
import com.woniu.util.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
public class HisDiseaseQueryApiImpl implements HisDiseaseQueryApi {
    @Resource
    private HisDiseaseService hisDiseaseService;
    @Override
    public Result<HisDiseaseDto> newDiseases(AddHisDiseaseParam addHisDiseaseParam) {
        HisDiseaseDto hisDiseaseDto = hisDiseaseService.newMedicalRecord(addHisDiseaseParam);
        return Result.bulid(hisDiseaseDto);
    }

    @Override
    public Result<HisDiseaseDto> modifyDisease(ModifyDiseaseParam modifyDiseaseParam) {
        HisDiseaseDto hisDiseaseDto = hisDiseaseService.modifyDisease(modifyDiseaseParam);
        return Result.bulid(hisDiseaseDto);
    }

    @Override
    public Result<Boolean> deleteDisease(ArrayList<Integer> id) {
        Boolean aBoolean = hisDiseaseService.deleteDisease(id);
        return Result.bulid(aBoolean);
    }

    @Override
    public Result<AllHisDiseaseDto> queryMedicalRecords(ListHisDiseaseParam listHisDiseaseParam) {
        AllHisDiseaseDto allHisDiseaseDto = hisDiseaseService.queryDisease(listHisDiseaseParam);
        return Result.bulid(allHisDiseaseDto);
    }
}
